package com.xf.common.core.feign;

import com.xf.common.core.domain.DmpResult;
import com.xf.common.core.entity.dmp.UserConnection;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * @author JoeyLiu
 * @create 2022-04-19 10:37
 */

@FeignClient(name = "UserConnectionConsumer", url = "${dmp.saas.user.url.prefix}", configuration = OAuth2FeignRequestInterceptor.class)
public interface UserConnectionConsumer {
    String PREFIX = "/UserConnection";

    /**
     * 根据条件查询关联关系
     *
     * @param providerName   平台名称
     * @param providerUserId 平台用户ID
     * @return 关联关系
     */
    @PostMapping(value = PREFIX + "/selectByCondition")
    DmpResult<UserConnection> selectByCondition(@RequestParam String providerName, @RequestParam String providerUserId);

    /**
     * 根据条件查询关联关系
     *
     * @param username 用户名
     * @return 关联关系
     */
    @PostMapping(value = PREFIX + "/selectByConditions")
    DmpResult<List<UserConnection>> selectByConditions(@RequestParam String username);

    /**
     * 新增
     *
     * @param userConnection userConnection
     * @retur
     */
    @PostMapping(value = PREFIX + "/createUserConnection")
    DmpResult createUserConnection(@RequestBody UserConnection userConnection);

    /**
     * 删除
     *
     * @param username     username 用户名
     * @param providerName providerName 平台名称
     * @return
     */
    @PostMapping(value = PREFIX + "/deleteByCondition")
    DmpResult deleteByCondition(@RequestParam String username, @RequestParam String providerName);

}
